package jee.boot.module.log.dao;

import jee.boot.common.basic.CrudDao;
import jee.boot.entity.log.LogEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.Map;

@Mapper
public interface LogEntityDao extends CrudDao<LogEntity> {
    /**
     * 插入本地日志
     * @param log
     * @return
     */
    @Insert("INSERT INTO st_log (\n" +
            "type,\n" +
            "remote_addr,\n" +
            "user_agent,\n" +
            "request_uri,\n" +
            "method,\n" +
            "exception,\n" +
            "create_by,\n" +
            "update_by,\n" +
            "create_date,\n" +
            "update_date,\n" +
            "status,\n" +
            "id \n" +
            ")\n" +
            "VALUES\n" +
            "\t(\n" +
            "#{type},\n" +
            "#{remoteAddr},\n" +
            "#{userAgent},\n" +
            "#{requestUri},\n" +
            "#{method},\n" +
            "#{exception},\n" +
            "#{createBy.id},\n" +
            "#{updateBy.id},\n" +
            "#{createDate},\n" +
            "#{updateDate},\n" +
            "'Y',\n" +
            "uuid())")
    public int insertLocalLog(Map<String,Object>log);
}
